package gui;

import java.awt.Component;

import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.table.TableCellRenderer;

public class TableCellRendererLineBreak extends JTextArea implements TableCellRenderer {

	private static final long serialVersionUID = 1;

	@Override
	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
		setText(value.toString()); 
		setLineWrap(true);
		setWrapStyleWord(true);
		if (isSelected) {
			setBackground(table.getSelectionBackground());
			setForeground(table.getSelectionForeground());
		} 
		else {
			setBackground(table.getBackground());
			setForeground(table.getForeground());
		}
//		if(hasFocus){
//			setBackground(Color.orange);
//		}
//		else{
//			setBorder(null);
//		}
		return this;
	}
}